#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    button = new QPushButton(this);
    button->setText("Hello World");

    connect(button,&QPushButton::clicked,this,&Widget::handleClick);
    button->QWidget::move(150,300);

    connect(ui->btn,&QPushButton::clicked,this,&Widget::handleClick2);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClick()
{
    if(button->text()==QString("Hello World"))
    {
        button->setText("Hello QT");
    }
    else
    {
        button->setText("Hello World");
    }
}

void Widget::handleClick2()
{
    if(ui->btn->text()==QString("Hello World"))
    {
        ui->btn->setText("Hello QT");
    }
    else
    {
        ui->btn->setText("Hello World");
    }
}

